package com.birdboot.controller;

import com.birdboot.entity.User;
import com.birdboot.http.HttpServletRequest;
import com.birdboot.http.HttpServletResponse;

import java.io.File;
import java.io.IOException;

public class UserController {
    public void reg(HttpServletRequest request, HttpServletResponse response){
        // 1、通过表单获取数据
        String username = request.getParameters("username");
        String password = request.getParameters("password");
        String nickname = request.getParameters("nickname");
        String ageStr = request.getParameters("age");
        System.out.println(username+","+password+","+nickname+","+ageStr);
        // 必要验证
        if (username==null||username.isEmpty()||
            password==null||password.isEmpty()||
            nickname==null||nickname.isEmpty()||
            !ageStr.matches("[0-9]+")){
            // 重定向注册失败页面
            response.sentRedirect("/reg_info_error.html");
            return;
        }
    }
}
